#import "President.h"

//asd

@interface President ()
@property NSMutableArray* assistants;
@end

@implementation President

static BOOL isInited = NO;

+(id) sharedPresident {
    static President* p = nil;
    if (p==nil)
        p = [[super alloc] init];
    
    return p;
}


+(id)alloc {
    return [President sharedPresident];
}

-(id)copy {
    return [President sharedPresident];
}

-(id)mutableCopy {
    return [President sharedPresident];
}

- (instancetype)init
{
    if (isInited)
        return  self;
    
    self = [super init];
    if (self) {
        //.... initializing president
        NSLog(@"New President!");
        isInited = YES;
//        NSLog(@"Assistants : %@", _assistants);
    }
    return self;
}

//lazy loading
-(NSMutableArray *)assistants {
    if (_assistants == nil) {
        _assistants = [NSMutableArray arrayWithObjects:@"Katia", @"Pena", @"Mimi", nil];
    }
    return _assistants;
}

-(void) addAssistant:(NSString*) assistantName {
    if (assistantName) {
        [self.assistants addObject:assistantName];
    }
}


@end
